home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / gvvbx1 / gvvbx.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-06-12  |  13.7 KB  |  475 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Graphics Viewer - VBX"
  4.    ClientHeight    =   6510
  5.    ClientLeft      =   60
  6.    ClientTop       =   630
  7.    ClientWidth     =   9480
  8.    ForeColor       =   &H00000000&
  9.    Height          =   7200
  10.    Left            =   0
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   434
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   632
  15.    Top             =   0
  16.    Width           =   9600
  17.    Begin PictureBox Pic_GrayBox 
  18.       BackColor       =   &H00C0C0C0&
  19.       Height          =   255
  20.       Left            =   9240
  21.       ScaleHeight     =   225
  22.       ScaleWidth      =   225
  23.       TabIndex        =   0
  24.       Top             =   6240
  25.       Visible         =   0   'False
  26.       Width           =   255
  27.    End
  28.    Begin VScrollBar VScroll1 
  29.       Height          =   6255
  30.       LargeChange     =   100
  31.       Left            =   9240
  32.       SmallChange     =   20
  33.       TabIndex        =   2
  34.       Top             =   0
  35.       Visible         =   0   'False
  36.       Width           =   255
  37.    End
  38.    Begin HScrollBar HScroll1 
  39.       Height          =   255
  40.       LargeChange     =   100
  41.       Left            =   0
  42.       SmallChange     =   20
  43.       TabIndex        =   1
  44.       Top             =   6240
  45.       Visible         =   0   'False
  46.       Width           =   9255
  47.    End
  48.    Begin GVBOXVBX GVBox1 
  49.       BackColor       =   &H00FFFFFF&
  50.       ForeColor       =   &H000000FF&
  51.       Height          =   360
  52.       Left            =   0
  53.       TabIndex        =   3
  54.       Top             =   0
  55.       Visible         =   0   'False
  56.       Width           =   450
  57.    End
  58.    Begin Menu Mnu_File 
  59.       Caption         =   "&File"
  60.       Begin Menu Mnu_Print 
  61.          Caption         =   "&Print"
  62.          HelpContextID   =   2014
  63.       End
  64.       Begin Menu Mnu_Exit 
  65.          Caption         =   "E&xit"
  66.       End
  67.    End
  68.    Begin Menu Mnu_Picture 
  69.       Caption         =   "&Picture"
  70.       HelpContextID   =   2010
  71.       Begin Menu Mnu_Open 
  72.          Caption         =   "&Open"
  73.          HelpContextID   =   2010
  74.       End
  75.       Begin Menu Mnu_Close 
  76.          Caption         =   "&Close"
  77.          HelpContextID   =   2010
  78.       End
  79.    End
  80.    Begin Menu Mnu_Options 
  81.       Caption         =   "&Options"
  82.       Begin Menu Mnu_Auto 
  83.          Caption         =   "&Autosize"
  84.          HelpContextID   =   2005
  85.          Begin Menu Mnu_AutoSize 
  86.             Caption         =   "&Off"
  87.             HelpContextID   =   2005
  88.             Index           =   0
  89.          End
  90.          Begin Menu Mnu_AutoSize 
  91.             Caption         =   "Fit to &Bitmap"
  92.             Checked         =   -1  'True
  93.             HelpContextID   =   2005
  94.             Index           =   1
  95.          End
  96.          Begin Menu Mnu_AutoSize 
  97.             Caption         =   "Fit &Horizontally"
  98.             HelpContextID   =   2005
  99.             Index           =   2
  100.          End
  101.          Begin Menu Mnu_AutoSize 
  102.             Caption         =   "Fit &Vertically"
  103.             HelpContextID   =   2005
  104.             Index           =   3
  105.          End
  106.       End
  107.       Begin Menu Mnu_Dither 
  108.          Caption         =   "&Dithering..."
  109.          HelpContextID   =   2007
  110.          Begin Menu Mnu_Dith 
  111.             Caption         =   "&No Dithering"
  112.             HelpContextID   =   2007
  113.             Index           =   0
  114.          End
  115.          Begin Menu Mnu_Dith 
  116.             Caption         =   "&Dither Always"
  117.             HelpContextID   =   2007
  118.             Index           =   1
  119.          End
  120.          Begin Menu Mnu_Dith 
  121.             Caption         =   "Dither Extra &Colors"
  122.             Checked         =   -1  'True
  123.             HelpContextID   =   2007
  124.             Index           =   2
  125.          End
  126.       End
  127.       Begin Menu Mnu_Thumbnail 
  128.          Caption         =   "&Thumbnail"
  129.          HelpContextID   =   2018
  130.       End
  131.    End
  132.    Begin Menu Mnu_JPEG 
  133.       Caption         =   "&JPEG Options"
  134.       HelpContextID   =   2025
  135.       Begin Menu Mnu_DCTM 
  136.          Caption         =   "&DCT Method..."
  137.          HelpContextID   =   2006
  138.          Begin Menu Mnu_DCT 
  139.             Caption         =   "&Slow Integer"
  140.             HelpContextID   =   2006
  141.             Index           =   0
  142.          End
  143.          Begin Menu Mnu_DCT 
  144.             Caption         =   "&Fast Integer"
  145.             Checked         =   -1  'True
  146.             HelpContextID   =   2006
  147.             Index           =   1
  148.          End
  149.          Begin Menu Mnu_DCT 
  150.             Caption         =   "Floating &Point"
  151.             HelpContextID   =   2006
  152.             Index           =   2
  153.          End
  154.       End
  155.       Begin Menu Mnu_JPGDithM 
  156.          Caption         =   "Dithering &Method..."
  157.          HelpContextID   =   2007
  158.          Begin Menu Mnu_JPGDith 
  159.             Caption         =   "&None"
  160.             HelpContextID   =   2007
  161.             Index           =   0
  162.          End
  163.          Begin Menu Mnu_JPGDith 
  164.             Caption         =   "&Ordered"
  165.             Checked         =   -1  'True
  166.             HelpContextID   =   2007
  167.             Index           =   1
  168.          End
  169.          Begin Menu Mnu_JPGDith 
  170.             Caption         =   "&Floyd-Steinberg"
  171.             HelpContextID   =   2007
  172.             Index           =   2
  173.          End
  174.       End
  175.       Begin Menu Mnu_Fancy 
  176.          Caption         =   "&Fancy Upsampline"
  177.          HelpContextID   =   2008
  178.       End
  179.       Begin Menu Mnu_TwoPass 
  180.          Caption         =   "&Two Pass Quantize"
  181.          HelpContextID   =   2019
  182.       End
  183.    End
  184.    Begin Menu Mnu_Zoom 
  185.       Caption         =   "&Zoom"
  186.       HelpContextID   =   2020
  187.       Begin Menu Mnu_Pict 
  188.          Caption         =   "&Picture..."
  189.          HelpContextID   =   2020
  190.          Begin Menu Mnu_PZoom 
  191.             Caption         =   "&100%"
  192.             Checked         =   -1  'True
  193.             HelpContextID   =   2020
  194.             Index           =   0
  195.          End
  196.          Begin Menu Mnu_PZoom 
  197.             Caption         =   "&200%"
  198.             HelpContextID   =   2020
  199.             Index           =   1
  200.          End
  201.          Begin Menu Mnu_PZoom 
  202.             Caption         =   "&300%"
  203.             HelpContextID   =   2020
  204.             Index           =   2
  205.          End
  206.          Begin Menu Mnu_PZoom 
  207.             Caption         =   "&400%"
  208.             HelpContextID   =   2020
  209.             Index           =   3
  210.          End
  211.       End
  212.       Begin Menu Mnu_Prnt 
  213.          Caption         =   "P&rint..."
  214.          HelpContextID   =   2017
  215.          Begin Menu Mnu_PrZoom 
  216.             Caption         =   "&100%"
  217.             HelpContextID   =   2017
  218.             Index           =   0
  219.          End
  220.          Begin Menu Mnu_PrZoom 
  221.             Caption         =   "&200%"
  222.             Checked         =   -1  'True
  223.             HelpContextID   =   2017
  224.             Index           =   1
  225.          End
  226.          Begin Menu Mnu_PrZoom 
  227.             Caption         =   "&300%"
  228.             HelpContextID   =   2017
  229.             Index           =   2
  230.          End
  231.          Begin Menu Mnu_PrZoom 
  232.             Caption         =   "&400%"
  233.             HelpContextID   =   2017
  234.             Index           =   3
  235.          End
  236.          Begin Menu Mnu_PrZoom 
  237.             Caption         =   "&500%"
  238.             HelpContextID   =   2017
  239.             Index           =   4
  240.          End
  241.       End
  242.    End
  243.    Begin Menu Mnu_HelpM 
  244.       Caption         =   "&Help"
  245.       HelpContextID   =   2000
  246.       Begin Menu Mnu_Help 
  247.          Caption         =   "&Contents"
  248.          HelpContextID   =   2000
  249.          Index           =   0
  250.       End
  251.       Begin Menu Mnu_Help 
  252.          Caption         =   "&Events"
  253.          HelpContextID   =   2022
  254.          Index           =   1
  255.       End
  256.       Begin Menu Mnu_Help 
  257.          Caption         =   "&Properties"
  258.          HelpContextID   =   2002
  259.          Index           =   2
  260.       End
  261.       Begin Menu Mnu_Help 
  262.          Caption         =   "&Search"
  263.          Index           =   3
  264.       End
  265.       Begin Menu Mnu_Help 
  266.          Caption         =   "&Using Help"
  267.          Index           =   4
  268.       End
  269.       Begin Menu Mnu_Help 
  270.          Caption         =   "-"
  271.          Index           =   5
  272.       End
  273.       Begin Menu Mnu_Help 
  274.          Caption         =   "&About"
  275.          HelpContextID   =   2004
  276.          Index           =   6
  277.       End
  278.    End
  279. Option Explicit
  280. DefInt A-Z
  281. Dim I%, PX!, PY!
  282. Const CONTENTS& = 2000
  283. Const EVENTS& = 2022
  284. Const MODAL = 1
  285. Const HELP_CONTEXT = &H1
  286. Const HELP_HELPONHELP = &H4
  287. Const PROPERTIES& = 2002
  288. Const SEARCH& = 1
  289. Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal HelpFile$, ByVal wCommand%, ByVal dwData&)
  290. Sub Form_Load ()
  291.     ChDir App.Path
  292.     Move 0, 0
  293.     Width = Screen.Width
  294.     Height = Screen.Height
  295. End Sub
  296. Sub Form_Resize ()
  297.     If GVBox1.Height > Form1.ScaleHeight Then
  298.     VScroll1.Visible = True
  299.     Else
  300.     VScroll1.Visible = False
  301.     End If
  302.     If GVBox1.Width > Form1.ScaleWidth Then
  303.     HScroll1.Visible = True
  304.     Else
  305.     HScroll1.Visible = False
  306.     End If
  307.     VScroll1.Max = GVBox1.Height - Form1.ScaleHeight + HScroll1.Height
  308.     HScroll1.Max = GVBox1.Width - Form1.ScaleWidth + VScroll1.Width
  309.     If VScroll1.Visible Or HScroll1.Visible Then
  310.     Pic_GrayBox.Visible = True
  311.     Else
  312.     Pic_GrayBox.Visible = False
  313.     End If
  314.     HScroll1.Width = Form1.ScaleWidth - VScroll1.Width
  315.     VScroll1.Height = Form1.ScaleHeight - HScroll1.Height
  316.     HScroll1.Move 0, Form1.ScaleHeight - HScroll1.Height
  317.     VScroll1.Move Form1.ScaleWidth - VScroll1.Width, 0
  318.     Pic_GrayBox.Move Form1.ScaleWidth - VScroll1.Width, Form1.ScaleHeight - HScroll1.Height
  319.     VScroll1.Max = GVBox1.Height - Form1.ScaleHeight + HScroll1.Height
  320.     HScroll1.Max = GVBox1.Width - Form1.ScaleWidth + VScroll1.Width
  321. End Sub
  322. Sub HScroll1_Change ()
  323.     PX = -HScroll1.Value
  324.     GVBox1.Move PX, PY
  325. End Sub
  326. Sub Mnu_AutoSize_Click (Index As Integer)
  327.     For I = 0 To 3
  328.     Mnu_Autosize(I).Checked = False
  329.     Next I
  330.     GVBox1.AutoSize = Index
  331.     Mnu_Autosize(Index).Checked = True
  332. End Sub
  333. Sub Mnu_Close_Click ()
  334.     GVBox1.FileName = ""
  335.     GVBox1.Visible = False
  336.     HScroll1.Visible = False
  337.     VScroll1.Visible = False
  338.     Pic_GrayBox.Visible = False
  339. End Sub
  340. Sub Mnu_DCT_Click (Index As Integer)
  341.     For I = 0 To 2
  342.     Mnu_DCT(I).Checked = False
  343.     Next I
  344.     GVBox1.DCTMethod = Index
  345.     Mnu_DCT(Index).Checked = True
  346. End Sub
  347. Sub Mnu_Dith_Click (Index As Integer)
  348.     For I = 0 To 2
  349.     Mnu_Dith(I).Checked = False
  350.     Next I
  351.     GVBox1.Dither = Index
  352.     Mnu_Dith(Index).Checked = True
  353. End Sub
  354. Sub Mnu_Exit_Click ()
  355.     End
  356. End Sub
  357. Sub Mnu_Fancy_Click ()
  358.     If Mnu_Fancy.Checked Then
  359.     Mnu_Fancy.Checked = False
  360.     Else
  361.     Mnu_Fancy.Checked = True
  362.     End If
  363.     GVBox1.FancyUpsampling = Mnu_Fancy.Checked
  364. End Sub
  365. Sub Mnu_Help_Click (Index As Integer)
  366.     Dim Ret%
  367.     Select Case Index
  368.     Case 0
  369.     Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, CONTENTS)
  370.     Case 1
  371.     Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, EVENTS)
  372.     Case 2
  373.     Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, PROPERTIES)
  374.     Case 3
  375.     Ret = WinHelp(Form1.hWnd, App.HelpFile, HELP_CONTEXT, SEARCH)
  376.     Case 4
  377.     Ret = WinHelp(Form1.hWnd, "", HELP_HELPONHELP, 0)
  378.     Case 6
  379.     About_Frm.Show MODAL
  380.     End Select
  381. End Sub
  382. Sub Mnu_JPGDith_Click (Index As Integer)
  383.     For I = 0 To 2
  384.     Mnu_JPGDith(I).Checked = False
  385.     Next I
  386.     GVBox1.JPEGDither = Index
  387.     Mnu_JPGDith(Index).Checked = True
  388. End Sub
  389. Sub Mnu_Open_Click ()
  390.     On Error GoTo Er_Hndl
  391.     GVBox1.Visible = False
  392.     GVBox1.FileName = ""
  393.     GVBox1.GVOpenPicture = True
  394.     If GVBox1.FileName <> "" Then
  395.     GVBox1.Visible = True
  396.     VScroll1.Value = 0
  397.     HScroll1.Value = 0
  398.     GVBox1.Left = 0
  399.     GVBox1.Top = 0
  400.     VScroll1.Visible = False
  401.     HScroll1.Visible = False
  402.     Pic_GrayBox.Visible = False
  403.     Form_Resize
  404.     End If
  405.     Exit Sub
  406. Er_Hndl:
  407.     Beep
  408.     MsgBox Error$, 48, "Graphics Viewer"
  409.     Exit Sub
  410. End Sub
  411. Sub Mnu_Print_Click ()
  412.     Screen.MousePointer = 11
  413.     Printer.Print " "
  414.     Printer.ScaleMode = 3
  415.     GVBox1.PrintX = (Printer.ScaleWidth - GVBox1.Width / (GVBox1.Zoom + 1) * (GVBox1.PrintZoom + 1)) / 2
  416.     GVBox1.PrintY = (Printer.ScaleHeight - GVBox1.Height / (GVBox1.Zoom + 1) * (GVBox1.PrintZoom + 1)) / 2
  417.     GVBox1.PrintHDC = Printer.hDC
  418.     Printer.EndDoc
  419.     Screen.MousePointer = 0
  420. End Sub
  421. Sub Mnu_PrZoom_Click (Index As Integer)
  422.     For I = 0 To 4
  423.     Mnu_PrZoom(I).Checked = False
  424.     Next I
  425.     GVBox1.PrintZoom = Index
  426.     Mnu_PrZoom(Index).Checked = True
  427. End Sub
  428. Sub Mnu_PZoom_Click (Index As Integer)
  429.     For I = 0 To 3
  430.     Mnu_PZoom(I).Checked = False
  431.     Next I
  432.     GVBox1.Zoom = Index
  433.     Mnu_PZoom(Index).Checked = True
  434.     If GVBox1.Visible Then Form_Resize
  435. End Sub
  436. Sub Mnu_Thumbnail_Click ()
  437.     If Mnu_Thumbnail.Checked Then
  438.     Mnu_Thumbnail.Checked = False
  439.     Else
  440.     Mnu_Thumbnail.Checked = True
  441.     End If
  442.     GVBox1.Thumbnail = Mnu_Thumbnail.Checked
  443.     If GVBox1.Thumbnail Then
  444.     VScroll1.Value = 0
  445.     HScroll1.Value = 0
  446.     GVBox1.Left = 0
  447.     GVBox1.Top = 0
  448.     VScroll1.Visible = False
  449.     HScroll1.Visible = False
  450.     Pic_GrayBox.Visible = False
  451.     Else
  452.     If GVBox1.Visible Then Form_Resize
  453.     End If
  454. End Sub
  455. Sub Mnu_TwoPass_Click ()
  456.     If Mnu_TwoPass.Checked Then
  457.     Mnu_TwoPass.Checked = False
  458.     Else
  459.     Mnu_TwoPass.Checked = True
  460.     End If
  461.     GVBox1.TwoPassQuantize = Mnu_TwoPass.Checked
  462. End Sub
  463. Sub Pic_GrayBox_Click ()
  464.     HScroll1.Value = HScroll1.Max
  465.     VScroll1.Value = VScroll1.Max
  466. End Sub
  467. Sub Pic_GrayBox_DblClick ()
  468.     HScroll1.Value = 0
  469.     VScroll1.Value = 0
  470. End Sub
  471. Sub VScroll1_Change ()
  472.     PY = -VScroll1.Value
  473.     GVBox1.Move PX, PY
  474. End Sub
  475.